﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using TraceabilityApp_Api.Application.Command.Goods;
using TraceabilityApp_Api.DTO;
using TraceabilityApp_ErrorCode;

namespace TraceabilityApp_Api.Controllers
{
    /// <summary>
    /// 商品控制器
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class GoodsController : ControllerBase
    {
        private readonly IMediator mediator;

        public GoodsController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 商品下拉框
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<GoodsDTO>>> GetGoods([FromQuery]GetGoodsCommand request)
        {
            return mediator.Send(request);
        }
    }
}
